/**
 * Created by lenovo on 2017/2/24.
 */
(function (angular) {
    angular.module('index',[
        'Maodian'
        ,'ngRoute'
        ,'Less_Than_Better'
        ,'memoirs'
    ]).config(['$routeProvider',function ($routeProvider) {
        $routeProvider.otherwise({
            redirectTo:'/index'
        })
    }]).controller('indexController',['$scope','$location',function ($scope,$location) {
        //取消浏览器默认行为
        $scope.prevent = prevent;
        //数据存储
        $scope.navsI = ['about me','memoirs','your words'];
        $scope.learn = ['html5','css3','javascript','Jq','js面向对象','Bootstrap'];
        $scope.contact = [
            {QQ:'1736315428'},
            {weixin:'qy13335601263'},
            {email:'1736315428@qq.com'}
        ];
        $scope.navs = [
            'Less_Than_Better',
            'index',
            'memoirs',
            'your_words'
        ];
        //导航栏样式控制
        $scope.location = $location;
        $scope.$watch('location.url()',function (now){
            switch(now){
                case '/index' :
                    $scope.index = true;
                    $scope.memoirs = false;
                    $scope.your_words = false;
                    break;
                case '/memoirs':
                    $scope.index = false;
                    $scope.memoirs = true;
                    $scope.your_words = false;
                    break;
                case '/your_words' :
                    $scope.index = false;
                    $scope.memoirs = false;
                    $scope.your_words = true;
                    break;
            }
        })
    }]);
    var prevent = function (e) {
        e = e || window.event;
        e.preventDefault();
        return false;
    };
})(angular);